//
//  StudentView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/5/31.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "StudentView.h"

@implementation StudentView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
        [self initOption];
    }
    return self;
}
- (void)initSubView{
    [self addSubview:self.headerImageView];
    [self addSubview:self.nameLabel];
    [self addSubview:self.duiHaoImageView];
}
- (void)uploadView{
}
- (void)initOption{
}
- (UIImageView *)headerImageView{
    if (!_headerImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.frame = CGRectMake(10, 2, 46, 46);
        imageView.layer.cornerRadius = 23;
        imageView.layer.masksToBounds = YES;
        imageView.backgroundColor = [UIColor whiteColor];
        _headerImageView = imageView;
    }
    return _headerImageView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(_headerImageView.frame.size.width+20, 2, 50, 46)];
        label.textAlignment = 0;
        label.text = @"王铁蛋";
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = TITLECOLOR;
        _nameLabel = label;
    }
    return _nameLabel;
}
- (UIButton *)duiHaoImageView{
    if (!_duiHaoImageView) {
        UIButton *imageView = [UIButton buttonWithType:UIButtonTypeCustom];
        imageView.frame = CGRectMake(_headerImageView.frame.size.width+60, 19.5, 12, 11);
        imageView.userInteractionEnabled = NO;
        [imageView setBackgroundImage:[UIImage imageNamed:@"yj_pigai_dui"] forState:0];
        [imageView setBackgroundImage:[UIImage imageNamed:@"yj_pigai_cuo"] forState:UIControlStateSelected];
        imageView.backgroundColor = [UIColor whiteColor];
        _duiHaoImageView = imageView;
    }
    return _duiHaoImageView;
}
@end
